package org.syncsoft.overalt.common.api;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.lang.StringEscapeUtils;

public class Resource {
	private static Properties properties;
	
	static {
		try {
			setProperties(new Properties());
			InputStream stream = Configuration.class.getClassLoader().getResourceAsStream("overaltResource.properties");
			getProperties().load(stream);
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static String getProperty(String property) {
		String value = StringEscapeUtils.unescapeJava(getProperties().getProperty(property));
		return value == null ? property : value;
	}

	protected static Properties getProperties() {
		return properties;
	}

	public static void setProperties(Properties properties) {
		Resource.properties = properties;
	}
}
